import sessionStore from 'store'
const state = {
  catList: []
}

const mutations = {
  setCatList (state, data) {
    state.catList = data
  }
}

const actions = {
  setCatList ({ commit, state }) {
    sessionStore.set('anme', 'lisi')
    if (state.catList.length == 0) {
      let url = process.env.VUE_APP_getMenu_url
      window.axios.post(url).then((ret) => {
        commit('setCatList', ret.data)
      }).catch(() => {

      })
    }
  }
}
export default {
  namespace: true,
  state,
  mutations,
  actions
}